
import type { IPoductQuery, IVideoDitails , IlatestLearn, IChapter, IVideoMaterials} from '~/types/api'
/**
*@desc 通过查询分类相关接口
*/
export const queryProductByCid = async (opinion: { cid?: number, cpid?: number, page: number, size: number }) => {
    return await useApi<IPoductQuery>('/product/v1/query_by_cid', {
        method: 'post',
        body: {
            ...opinion
        }
    })
}

// 获取视频详情
export const getVideoDetails = async (id: number) => {
    return await useApi<IVideoDitails>('/product/v1/detail', {
        method: 'get',
        params: {
            id
        }
    })
}
// 最近在学
export const getLatestLearn = async (id: number) => {
    return await useApi<IlatestLearn>('/order/v1/latest', {
        method: 'get',
        params: {
            id
        }
    })
}

// 获取章节
export const getChapter = async (id: number) => {
    return await useApi<IChapter>('/product/v1/chapter', {
        method: 'get',
        params: {
            id
        }
    })
}

// 获取视频材料下载全新
export const getVideoMaterials = async (id: number) => {
    return await useApi<IVideoMaterials>('/product/v1/material_by_id', {
        method: 'get',
        params: {
            id
        }
    })
}

